#include <cstdio>

const int N = 200005;
int n, m, k[N];

struct Node {
  int ch[2], fa, siz;
  bool rev;
} tr[N];

inline bool iden(register int x) { return tr[tr[x].fa].ch[1] == x; }

inline bool isrt(register int x) {
  return tr[tr[x].fa].ch[0] != x && tr[tr[x].fa].ch[1] != x;
}

inline void pushup(register int x) {
  tr[x].siz = tr[tr[x].ch[0]].siz + tr[tr[x].ch[1]].siz + 1;
}

inline void reverse(register int x) {
  static int tmp;
  tmp = tr[x].ch[0];
  tr[x].ch[0] = tr[x].ch[1];
  tr[x].ch[1] = tmp;
  tr[x].rev ^= 1;
}

inline void pushdown(register int x) {
  if (tr[x].rev) {
    if (tr[x].ch[0]) reverse(tr[x].ch[0]);
    if (tr[x].ch[1]) reverse(tr[x].ch[1]);
    tr[x].rev = false;
  }
}

inline void pushall(int x) {
  if (!isrt(x)) pushall(tr[x].fa);
  pushdown(x);
}

inline void rotate(register int x) {
  bool xtofa = iden(x);
  int fa = tr[x].fa, ffa = tr[fa].fa, son = tr[x].ch[!xtofa];
  if (!isrt(fa)) { tr[ffa].ch[iden(fa)] = x; }
  tr[x].fa = ffa;
  tr[x].ch[!xtofa] = fa;
  tr[fa].ch[xtofa] = son;
  if (son) tr[son].fa = fa;
  tr[fa].fa = x;
  pushup(fa);
}

inline void splay(register int x) {
  pushall(x);
  for (; !isrt(x); rotate(x))
    if (!isrt(tr[x].fa)) rotate(iden(x) == iden(tr[x].fa) ? tr[x].fa : x);
  pushup(x);
}

inline void access(register int x) {
  for (int y = 0; x; y = x, x = tr[x].fa) splay(x), tr[x].ch[1] = y, pushup(x);
}

inline void makert(register int x) { access(x), splay(x), reverse(x); }

inline int findrt(register int x) {
  access(x), splay(x);
  while (tr[x].ch[0]) { pushdown(x), x = tr[x].ch[0]; }
  splay(x);
  return x;
}

inline void cut(int x, int y) {
  makert(x), access(y), splay(y), tr[y].ch[0] = tr[x].fa = 0, pushup(y);
}

inline void link(int x, int y) { makert(x), tr[x].fa = y; }

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("testdata.in", "r", stdin);
  freopen("testdata.out", "w", stdout);
#else
  freopen("P3203 [HNOI2010]弹飞绵羊.in", "r", stdin);
  freopen("P3203 [HNOI2010]弹飞绵羊.out", "w", stdout);
#endif
#endif

  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &k[i]);
    link(i, i + k[i] > n ? n + 1 : i + k[i]);
  }
  scanf("%d", &m);
  for (int i, j, K; m; --m) {
    scanf("%d%d", &i, &j), ++j;
    if (i == 1) {
      makert(j);
      access(n + 1);
      splay(n + 1);
      printf("%d\n", tr[n + 1].siz - 1);
    } else {
      scanf("%d", &K);
      cut(j, j + k[j] > n ? n + 1 : j + k[j]);
      link(j, j + K > n ? n + 1 : j + K);
      k[j] = K;
    }
  }
  return 0;
}